package com.lora.entity;

import com.acooly.core.common.domain.AbstractEntity;
import com.lora.common.ColumnParse;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * 电量仪 Entity
 *
 * @author qiudot
 * Date: 2019-09-21 19:45:55
 */
@Entity
@Table(name = "lora_electricity_meter")
@Getter
@Setter
public class ElectricityMeter extends AbstractEntity {

    /**
     * 设备编号
     */
    @Size(max = 64)
    private String equipmentid;

    /**
     * 原始数据
     */
    @Size(max = 5124)
    private String datastring;

    /**
     * A相电压/AB线电压
     */
    @ColumnParse(seq = 1, ratio = 0.01)
    private BigDecimal aVoltage;

    /**
     * B相电压/BC线电压
     */
    @ColumnParse(seq = 2, ratio = 0.01)
    private BigDecimal bVoltage;

    /**
     * C相电压/CA线电压
     */
    @ColumnParse(seq = 3, ratio = 0.01)
    private BigDecimal cVoltage;

    /**
     * A相电流
     */
    @ColumnParse(seq = 4, ratio = 0.001 * 30)
    private BigDecimal aCurrent;

    /**
     * B相电流
     */
    @ColumnParse(seq = 5, ratio = 0.001 * 30)
    private BigDecimal bCurrent;

    /**
     * C相电流
     */
    @ColumnParse(seq = 6, ratio = 0.001 * 30)
    private BigDecimal cCurrent;

    /**
     * 总有功功率 低16
     */
    @ColumnParse(seq = 7, ratio = 1)
    private BigDecimal totalAvailablePowerMin;

    /**
     * 总有功功率 高16位
     */
    @ColumnParse(seq = 8, ratio = 1)
    private BigDecimal totalAvailablePowerMax;

    /**
     * 总无功功率 低16位
     */
    @ColumnParse(seq = 9, ratio = 1)
    private BigDecimal totalUselessPowerMin;

    /**
     * 总无功功率 高16位
     */
    @ColumnParse(seq = 10, ratio = 1)
    private BigDecimal totalUselessPowerMax;

    /**
     * 功率因数总和
     */
    @ColumnParse(seq = 11, ratio = 0.001)
    private BigDecimal totalPowerFactor;

    /**
     * A相有功功率
     */
    @ColumnParse(seq = 12, ratio = 1)
    private BigDecimal aAvailablePower;

    /**
     * B相有功功率
     */
    @ColumnParse(seq = 13, ratio = 1)
    private BigDecimal bUselessPower;

    /**
     * C相有功功率
     */
    @ColumnParse(seq = 14, ratio = 1)
    private BigDecimal cUselessPower;

    /**
     * A相无功功率
     */
    @ColumnParse(seq = 15, ratio = 1)
    private BigDecimal aUselessPower;

    /**
     * B相无功功率
     */
    @ColumnParse(seq = 16, ratio = 1)
    private BigDecimal bAvailablePower;

    /**
     * C相无功功率
     */
    @ColumnParse(seq = 17, ratio = 1)
    private BigDecimal cAvailablePower;

    /**
     * A相功率因数
     */
    @ColumnParse(seq = 18, ratio = 0.001)
    private BigDecimal aPowerFactor;

    /**
     * B相功率因数
     */
    @ColumnParse(seq = 19, ratio = 0.001)
    private BigDecimal bPowerFactor;

    /**
     * C相功率因数
     */
    @ColumnParse(seq = 20, ratio = 0.001)
    private BigDecimal cPowerFactor;

    /**
     * 频率
     */
    @ColumnParse(seq = 21, ratio = 0.01)
    private BigDecimal rate;

    private boolean alarmFlag = false;

}
